package MyDS.Test;

import MyDS.DoubleLinkedList.DoubleLinkedList;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
 * @Author: ylc
 * @Description:
 * @Date Created in 2022-04-18 18:10
 */
public class DoubleLinkedListTest {
    int[] data = {41,58,50,60,60,42,53,59,63,63};
    DoubleLinkedList dl = new DoubleLinkedList();
    @Before
    public void testAddFirst(){
        for (int i : data) {
            dl.addFirst(i);
        }
    }
    @Test
    public void testAddLast(){
        dl.addLast(10);
        System.out.println(dl);
    }
    @Test
    public void testAddIndex(){
        dl.addIndex(1,2);
        System.out.println(dl);
    }
    @Test
    public void testGet(){
        Assert.assertEquals(59,dl.get(1));
    }
    @Test
    public void testSet(){
        dl.set(0,0);
        System.out.println(dl);
    }
    @Test
    public void testContains(){
        Assert.assertTrue(dl.contains(60));
    }
    @Test
    public void testRemoveFirst(){
        dl.removeFirst();
        System.out.println(dl);
    }
    @Test
    public void testRemoveLast(){
        dl.removeLast();
        System.out.println(dl);
    }
    @Test
    public void testRemoveIndex(){
        dl.removeIndex(2);
        System.out.println(dl);
    }
    @Test
    public void testRemoveValue(){
        dl.removeValue(60);
        System.out.println(dl);
    }
    @Test
    public void testRemoveAllValue(){
        dl.removeAllValue(63);
        System.out.println(dl);
    }
}
